{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 使用scipy.io下载 .mat文件\n",
    "得到的是字典格式，键值对"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dict_keys(['__header__', '__version__', '__globals__', 'emg', 'acc', 'stimulus', 'glove', 'inclin', 'subject', 'exercise', 'repetition', 'restimulus', 'rerepetition'])\n",
      "dict_keys(['__header__', '__version__', '__globals__', 'emg', 'acc', 'stimulus', 'glove', 'inclin', 'subject', 'exercise', 'repetition', 'restimulus', 'rerepetition'])\n",
      "dict_keys(['__header__', '__version__', '__globals__', 'emg', 'acc', 'stimulus', 'force', 'forcecal', 'subject', 'exercise', 'activation', 'repetition', 'restimulus', 'rerepetition'])\n"
     ]
    }
   ],
   "source": [
    "import scipy.io as scio\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "E1 = scio.loadmat('DB2//S1_E1_A1.mat')\n",
    "E2 = scio.loadmat('DB2//S1_E2_A1.mat')\n",
    "E3 = scio.loadmat('DB2//S1_E3_A1.mat')\n",
    "\n",
    "print(E1.keys())\n",
    "print(E2.keys())\n",
    "print(E3.keys())\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 合并E1，E2，E3数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(2397479, 12)\n",
      "(2397479, 1)\n",
      "[[ 0]\n",
      " [ 0]\n",
      " [ 0]\n",
      " ..., \n",
      " [48]\n",
      " [48]\n",
      " [48]]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f37c42586a0>]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgA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H6Zd3uN7gU+fuh/waeDefuX3emV1wM5+5Sf3S3aMNNS3gYFfiL7VNdkx0lz/ZF8KAz7LxNcWWZHsM0/8S+0wUOCVn9yv77Xe4wJvP0t2jDR9Dp4Ersi1839K3QN17oPQZTQLeLff8wNeWZA44Jdm9prF15gGqHXONQN4v6d75cnqO1T5gQTlQx0j3fysa6Z8fv7c67K43z7ouhtt/auBNudc5JTyAe/lbT/u7e9L/b1ui3OBDeTY+T+l7hCgcx+EhGAJyoJ2adSFzrnzgKuAW83s4iH2TVbf0ZYHQTrqmgn/Pj8E5gNLgGbg77zyiax/xnw+zKwc+Dlwu3OufahdE5QF+vwnqHugzn0QEsIBYE6/57OBgz7FMibOuYPe71bgCWAp0GJmdQDe71Zv92T1Hap8doJyhjhGuvlZV98/P865Fudc1DkXA35M/PwPFVuy8sNApZkVnFI+4L287VOAo0O8V0qYWSHxL8SHnHOPe8U5cf4T1T1o5z4ICeEVYKE3wl5EfNDkKZ9jGjEzKzOzyX2PgSuBbcTr0Hf1xGrifY545Z/zro5YDhz3msDPA1ea2VSv2Xkl8T7EZqDDzJZ7V1x87pT3SnSMdPOzrsmOkTZ9X1Se64if/77YbvSuEmkEFhIfNE34mXfxjuDfANd7rz+1nn31vx74tbd/smOkop4G3AfscM79fb9NWX/+k9U9cOc+1YMrEzRAs4r4qP3bwJ1+xzPK2OcRH+l/A3izL37ifXwvAG95v6u8cgPu8eq6FWjq9143A7u9ny/0K2/yPmhvAz/ggwmHCY+R4vo+TLxpHCb+F8otftZ1qGOksf4/9Y69xftPWtdv/zu92HbhXTEz1Gfe+zxt9P5d/hUo9spLvOe7ve3zhjtGCup+EfEuiS3AZu9nVS6c/yHqHqhzr5nKIiICBKPLSERE0kAJQUREACUEERHxKCGIiAighCAiIh4lBBERAZQQRETEo4QgIiIA/H8r0G8wLeMXGQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f385c0ebba8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "E1_emg = E1['emg']\n",
    "E2_emg = E2['emg']\n",
    "E3_emg = E3['emg']\n",
    "\n",
    "E1_label = E1['restimulus']\n",
    "E2_label = E2['restimulus']\n",
    "E3_label = E3['restimulus']\n",
    "\n",
    "index1 =[]\n",
    "for i in range(len(E1_label)):\n",
    "    if E1_label[i]!=0:\n",
    "        index1.append(i)\n",
    "label1 = E1_label[index1,:]\n",
    "emg1 = E1_emg[index1,:]\n",
    "\n",
    "index2 =[]\n",
    "for i in range(len(E2_label)):\n",
    "    if E2_label[i]!=0:\n",
    "        index2.append(i)\n",
    "label2 = E2_label[index2,:]\n",
    "emg2 = E2_emg[index2,:]\n",
    "\n",
    "index3 =[]\n",
    "for i in range(len(E3_label)):\n",
    "    if E3_label[i]!=0:\n",
    "        index3.append(i)\n",
    "label3 = E3_label[index3,:]\n",
    "emg3 = E3_emg[index3,:]\n",
    "\n",
    "emg = np.vstack((emg1,emg2,emg3))\n",
    "label = np.vstack((label1,label2,label3))\n",
    "label = label-1\n",
    "\n",
    "print(emg.shape)\n",
    "print(label.shape)\n",
    "print(label)\n",
    "\n",
    "plt.plot(label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f37bd3a5940>]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJztnXeYVNX5+D/v7rIsvUiVjoAgNmRFUEAUC5ZoNGo0JhpLiLEkMaZgiS0a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KyIlqR6HMWa18389IcfhMGCdiHR12t2VkPMsnXZVOJ9jt3vlFOBzY8w6p41ZP18OQZyfRDJcEZGLgdOBC40ztjfG7DHGbHI+zyJkXx+QpvyUn5mArlv9b5z9bYDNbu2KKHs2IYdwuL2Bnq9474Y06gvkHmtsCuAzoL+I9HF6m+cDk2wLEREB/gEsMMbcH7G9a0Sxs4B5zudJwPki0lRE+gD9CTly4rbXedCnAuc4v7+YkC0xWbtaiEir8GdC9vZ5jvyL49Q1CbhIQgwHtjlDx7eAk0SknTO8P4mQbXYNsF1Ehjvn4CIv7YogqmeW7fMVQRDnJ5GMhIjIOOA3wBnGmF0R2zuKSLHzua9zfpanKT/RMbq1K4jrFtnec4ApYQWYhBMI2cjrzSRBnq9E74Y06gvkHsuoczQbf4S86osJafkbMyRjJKFh15dEhMIBTxIKz/rSuRhdI35zo9OmRUREziRqL6GIiRmEQr3+BTT10K6+hCIs5hAKQbvR2b4f8C6h8LB3gfbOdgEecmTPBcoj6rrUkb0UuCRiezmhB34Z8CAewkCd3zUHNgFtIrYFfr4IKaA1QDWh3tRlQZyfRDKStGspITtwVPgi8B3n+s4BPge+la58t2N0aVfGrxtQ5nxf6uzvm6xdzvbHgStiygZ5vhK9G7J+j8X705nAiqIoBUpjMwEpiqIoHlEFoCiKUqCoAlAURSlQVAEoiqIUKKoAFEVRChRVAIqiKAWKKgBFUZQCRRWAoihKgfL/AZv1MUTc7L5UAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f38367f0f60>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(E1_emg[0:200000,5]*20000)\n",
    "plt.plot(E1_label[0:200000])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 提取时域特征\n",
    "\n",
    "### 100ms时间窗，增量窗设为0，1s数据内有10个样本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "class  0 ,number of sample:  78701 392\n",
      "class  1 ,number of sample:  58979 293\n",
      "class  2 ,number of sample:  50985 253\n",
      "class  3 ,number of sample:  45065 224\n",
      "class  4 ,number of sample:  40125 199\n",
      "class  5 ,number of sample:  25557 126\n",
      "class  6 ,number of sample:  58155 289\n",
      "class  7 ,number of sample:  28238 140\n",
      "class  8 ,number of sample:  39903 198\n",
      "class  9 ,number of sample:  45174 224\n",
      "class  10 ,number of sample:  43571 216\n",
      "class  11 ,number of sample:  44012 219\n",
      "class  12 ,number of sample:  39313 195\n",
      "class  13 ,number of sample:  37134 184\n",
      "class  14 ,number of sample:  23601 117\n",
      "class  15 ,number of sample:  44281 220\n",
      "class  16 ,number of sample:  40929 203\n",
      "class  17 ,number of sample:  40507 201\n",
      "class  18 ,number of sample:  23523 116\n",
      "class  19 ,number of sample:  39891 198\n",
      "class  20 ,number of sample:  37937 188\n",
      "class  21 ,number of sample:  40019 199\n",
      "class  22 ,number of sample:  34836 173\n",
      "class  23 ,number of sample:  48733 242\n",
      "class  24 ,number of sample:  44250 220\n",
      "class  25 ,number of sample:  71599 356\n",
      "class  26 ,number of sample:  32863 163\n",
      "class  27 ,number of sample:  47204 235\n",
      "class  28 ,number of sample:  72555 361\n",
      "class  29 ,number of sample:  78040 389\n",
      "class  30 ,number of sample:  65439 326\n",
      "class  31 ,number of sample:  49037 244\n",
      "class  32 ,number of sample:  46698 232\n",
      "class  33 ,number of sample:  61449 306\n",
      "class  34 ,number of sample:  37441 186\n",
      "class  35 ,number of sample:  45497 226\n",
      "class  36 ,number of sample:  43617 217\n",
      "class  37 ,number of sample:  42608 212\n",
      "class  38 ,number of sample:  45802 228\n",
      "class  39 ,number of sample:  58955 293\n",
      "class  40 ,number of sample:  61730 307\n",
      "class  41 ,number of sample:  59768 297\n",
      "class  42 ,number of sample:  62571 311\n",
      "class  43 ,number of sample:  57984 288\n",
      "class  44 ,number of sample:  59925 298\n",
      "class  45 ,number of sample:  68753 342\n",
      "class  46 ,number of sample:  55986 278\n",
      "class  47 ,number of sample:  62404 311\n",
      "class  48 ,number of sample:  56135 279\n",
      "(11914, 60)\n",
      "11914\n"
     ]
    }
   ],
   "source": [
    "from feature_utils import *  \n",
    "import math\n",
    "\n",
    "featureData=[]\n",
    "featureLabel = []\n",
    "classes = 48\n",
    "timeWindow = 200\n",
    "strideWindow = 200\n",
    "\n",
    "for i in range(classes):\n",
    "    index = [];\n",
    "    for j in range(label.shape[0]):\n",
    "        if(label[j,:]==i):\n",
    "            index.append(j)\n",
    "    iemg = emg[index,:]\n",
    "    length = math.floor((iemg.shape[0]-timeWindow)/strideWindow)\n",
    "    print(\"class \",i, \",number of sample: \",iemg.shape[0],length)\n",
    "    \n",
    "    for j in range(length):\n",
    "        rms = featureRMS(iemg[strideWindow*j:strideWindow*j+timeWindow,:])\n",
    "        mav = featureMAV(iemg[strideWindow*j:strideWindow*j+timeWindow,:])\n",
    "        wl  = featureWL( iemg[strideWindow*j:strideWindow*j+timeWindow,:])\n",
    "        zc  = featureZC( iemg[strideWindow*j:strideWindow*j+timeWindow,:])\n",
    "        ssc = featureSSC(iemg[strideWindow*j:strideWindow*j+timeWindow,:])\n",
    "        featureStack = np.hstack((rms,mav,wl,zc,ssc))\n",
    "        \n",
    "        featureData.append(featureStack)\n",
    "        featureLabel.append(i)\n",
    "featureData = np.array(featureData)\n",
    "\n",
    "print(featureData.shape)\n",
    "print(len(featureLabel))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 构造成图像数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "emg = emg*20000\n",
    "\n",
    "imageData=[]\n",
    "imageLabel=[]\n",
    "imageLength=200\n",
    "classes = 49\n",
    "\n",
    "for i in range(classes):\n",
    "    index = [];\n",
    "    for j in range(label.shape[0]):\n",
    "        if(label[j,:]==i):\n",
    "            index.append(j)\n",
    "            \n",
    "    iemg = emg[index,:]\n",
    "    length = math.floor((iemg.shape[0]-imageLength)/imageLength)\n",
    "    print(\"class \",i,\" number of sample: \",iemg.shape[0],length)\n",
    "    \n",
    "    for j in range(length):\n",
    "        subImage = iemg[imageLength*j:imageLength*(j+1),:]\n",
    "        imageData.append(subImage)\n",
    "        imageLabel.append(i)\n",
    "        \n",
    "imageData = np.array(imageData)\n",
    "print(imageData.shape)\n",
    "print(len(imageLabel))        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 保存h5文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import h5py\n",
    "file = h5py.File('DB2//DB2_S1_feature_200_0.h5','w')  \n",
    "file.create_dataset('featureData', data = featureData)  \n",
    "file.create_dataset('featureLabel', data = featureLabel)  \n",
    "file.close()  \n",
    "\n",
    "file = h5py.File('DB2//DB2_S1_image_200_0.h5','w')  \n",
    "file.create_dataset('imageData', data = imageData)  \n",
    "file.create_dataset('imageLabel', data = imageLabel)  \n",
    "file.close()  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
